package com.nearby.demand.presenter;

import com.nearby.demand.interactor.LoginInteractor;
import com.nearby.demand.interactor.LoginInteractorImpl;
import com.nearby.demand.interactor.OnLoginListener;
import com.nearby.demand.ui.view.LoginView;

/**
 * 登陆业务处理
 * Created by IME on 2015/12/28.
 */
public class LoginPersenterImpl implements LoginPersenter, OnLoginListener {


    private LoginView view;
    private LoginInteractor interactor;

    public LoginPersenterImpl(LoginView view) {
        this.view = view;
        this.interactor = new LoginInteractorImpl();


    }

    @Override
    public void validateCredentials(String username, String password) {
        interactor.login(username, password, this);
    }

    @Override
    public void onSuccess(String success) {
        view.startMain();
    }
}
